package ferp.center.server.poll;

import ferp.poll.Option;
import ferp.poll.Poll;
import ferp.poll.Question;

/**
 * User: igorgok
 * Date: 15/05/2014 09:24
 */
public class OnlineAppVersion implements Poll.Factory
{
  public static final class English extends Poll.Language
  {
    @Override
    public String title() {return "Preferans Online";}
    @Override
    public String description() {return "We would like to know your opinion on adding online multi-player support";}
    @Override
    public String bonus() {return "no ADs for 48 hours!";}

    @Override
    protected String[] questions() {return questions;}
    @Override
    protected String[][] options() {return options;}

    private static String[] questions = {
        "How often would you play Preferans online?",
        "Would you prefer to pay for",
        "What is the maximum amount you could pay per month?",
        "What is the maximum amount you could pay per 100 games?"
    };

    private static String[][] options = {
        {"Yes, often", "Yes, sometimes", "Yes, seldom", "Not interested at all"},
        {"Periodic subscription?", "Predefined number of games?"},
        {"$5", "$4", "$3", "$2", "$1"},
        {"$5", "$4", "$3", "$2", "$1"},
    };
  }

  public static final class Russian extends Poll.Language
  {
    @Override
    public String title() {return "Преферанс Онлайн";}
    @Override
    public String description() {return "Мы бы хотели узнать Ваше мнение о добавлении возможности играть онлайн";}
    @Override
    public String bonus() {return "48 часов без рекламы!";}

    @Override
    protected String[] questions() {return questions;}
    @Override
    protected String[][] options() {return options;}

    private static String[] questions = {
        "Хотели бы Вы играть в Преферанс Онлайн?",
        "Предпочитаете ли Вы платить за",
        "Какую максимальную сумму в месяц Вы были бы готовы платить?",
        "Какую максимальную сумму Вы были бы готовы заплатить за 100 игр?"
    };

    private static String[][] options = {
        {"Да, очень часто", "Да, иногда", "Да, редко", "Нет"},
        {"Месячную подписку на услугу?", "Определенное количество игр?"},
        {"$5", "$4", "$3", "$2", "$1"},
        {"$5", "$4", "$3", "$2", "$1"},
    };
  }

  @Override
  public Poll create(long id, Poll.Language language)
  {
    Question common;

    return
        // bonus: 2 days of ADless play
        new Poll(id, language, 2,
            // How often would you play Preferans online?
            new Question(language, 0,
                // Yes, often
                new Option(language, 0, 0,
                    // Would you prefer to pay for
                    common = new Question(language, 1,
                        // Periodic subscription?
                        new Option(language, 1, 0,
                            // What is the maximum amount you could pay per month?
                            new Question(language, 2,
                                // $5
                                new Option(language, 2, 0),
                                // $4
                                new Option(language, 2, 1),
                                // $3
                                new Option(language, 2, 2),
                                // $2
                                new Option(language, 2, 3),
                                // $1
                                new Option(language, 2, 4))),
                        // Predefined number of games?
                        new Option(language, 1, 1,
                            // What is the maximum amount you could pay per 100 games?
                            new Question(language, 3,
                                // $5
                                new Option(language, 3, 0),
                                // $4
                                new Option(language, 3, 1),
                                // $3
                                new Option(language, 3, 2),
                                // $2
                                new Option(language, 3, 3),
                                // $1
                                new Option(language, 3, 4))))),
                // Yes, sometimes
                new Option(language, 0, 1, common),
                // Yes, seldom
                new Option(language, 0, 2, common),
                // Not interested at all  ***[3]
                new Option(language, 0, 3)));
  }
}
